package com.example.demo.util;

import org.springframework.stereotype.Repository;

@Repository
public class Random {
    /**
     * 随机生成8位数的验证码
     */
    public String randomCode() {
        StringBuilder str = new StringBuilder();
        java.util.Random random = new java.util.Random();
        for (int i = 0; i < 8; i++) {
            str.append(random.nextInt(10));
        }
        return str.toString();
    }
}
